using System;
using System.Collections.Generic;
using System.Text;

using libsecondlife;
using libsecondlife.InventorySystem;

using Feathertail;

namespace NestBox.Inventory
{
    class rmdir : Feathertail.Command
    {
        FeathertailClient _Client;

        #region Command Members

        public void Setup(FeathertailClient Client)
        {
            _Client = Client;
        }

        public string HandleInput(string[] CmdLine)
        {
            if (CmdLine.Length < 2)
            {
                return GetHelpText();
            }

            string targetDir = NestBox.Inventory.Helpers.combineCmdArg(CmdLine);

            InventoryFolder iFolder = _Client.Inventory.getFolder(targetDir);
            if (iFolder == null)
            {
                return "Could not find directory: " + targetDir;
            }
            else
            {
                iFolder.Delete();
                return "Folder removed.";
            }
        }

        public string[] GetCommandStrings()
        {
            return new string[] { "rmdir" };
        }

        public string GetSummaryText()
        {
            return "Remove a folder from your inventory";
        }

        public string GetHelpText()
        {
            return "Usage: rmdir [directory]";
        }

        #endregion
    }
}
